Imports System.Data.Sql

Public Class FrmHoofdmenu

    Dim dtmDatumNu As Date = My.Computer.Clock.LocalTime.Date
    Dim werknummer As String = My.Forms.FrmInlogscherm.CmbWerknummer.SelectedValue

    Private Sub AboutDocRegToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutDocRegToolStripMenuItem.Click
        My.Forms.AboutBox1.Visible = True

    End Sub

    Private Sub BtnBedrijven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBedrijven.Click
        Me.Visible = False
        My.Forms.Bedrijven.Visible = True

    End Sub

    Private Sub BtnTekeningen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTekeningen.Click
        Me.Visible = False
        My.Forms.FrmTekeningen.Visible = True

    End Sub

    Private Sub BtnAfsluiten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnAfsluiten.Click
        Application.Exit()

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        LblDatum.Text = My.Computer.Clock.LocalTime.ToLongDateString

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        LblTijd.Text = My.Computer.Clock.LocalTime.ToShortTimeString

    End Sub

    Private Sub BtnVerzendbrief_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnVerzendbrief.Click
        Me.Visible = False
        My.Forms.FrmVerzendbrief.Visible = True

    End Sub

    Private Sub BtnNieuweTekening_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnNieuweTekening.Click
        Me.Visible = False
        My.Forms.FrmNieuweTekening.Visible = True

    End Sub

    Private Sub BtnTekeningenlijst_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnTekeningenlijst.Click
        Me.Visible = False
        My.Forms.FrmTekeningenlijst.Visible = True

    End Sub

    Private Sub BtnFrmInstellingen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFrmInstellingen.Click
        Me.Visible = False
        My.Forms.FrmInstellingen.Visible = True

    End Sub

    Private Sub BtnContacten_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnContacten.Click
        Me.Visible = False
        My.Forms.FrmContacten.Visible = True

    End Sub

    Private Sub BtnPlanning_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPlanning.Click
        Me.Visible = False
        My.Forms.frmBinnenkomst.Visible = True

    End Sub


    Private Sub BtnFrmVerzondenTekeningen2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFrmVerzondenTekeningen2.Click

        Me.Visible = False
        My.Forms.VerzondenTekeningen2.Visible = True

    End Sub


    Private Sub BtnFrmWijzigenTekeningen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnFrmWijzigenTekeningen.Click

        Me.Visible = False
        My.Forms.frmWijzigenTekeningen.Visible = True

    End Sub

    Private Sub FrmHoofdmenu_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim constr As String = My.Settings.Docregdata2ConnectionString
        Dim con As New SqlConnection(constr)
        Dim selectcmd1 As New SqlCommand
        With selectcmd1
            .CommandType = CommandType.StoredProcedure
            .CommandText = "NietRetourPerNu"
            .Connection = con
            .Parameters.AddWithValue("DatumNu", dtmDatumNu)
            .Parameters.AddWithValue("Werknummer", werknummer)
        End With

        Dim selectcmd2 As New SqlCommand
        With selectcmd2
            .CommandType = CommandType.StoredProcedure
            .CommandText = "BinnenkomstVandaag"
            .Connection = con
            .Parameters.AddWithValue("Werknummer", werknummer)
            .Parameters.AddWithValue("DatumNu", dtmDatumNu)
        End With

        Dim da As New SqlDataAdapter
        da.SelectCommand = selectcmd1

        Dim da2 As New SqlDataAdapter
        da2.SelectCommand = selectcmd2

        Dim ds As New DataSet

        con.Open()

        da.Fill(ds, "NietRetourTekeningen")
        da2.Fill(ds, "VandaagBinnen")

        con.Close()

        If ds.Tables("NietRetourTekeningen").Rows.Count > 0 Then

            MsgBox("Vandaag zouden er " & ds.Tables("VandaagBinnen").Rows.Count.ToString & " tekening(en) binnen moeten komen!", , "Planning-bericht!")
            MsgBox("Er zijn " & ds.Tables("NietRetourTekeningen").Rows.Count.ToString & " tekeningen te laat binnen", , "Planning-bericht!")

        End If

    End Sub

    Private Sub BtnMoedertblBedrijven_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMoedertblBedrijven.Click
        Me.Visible = False
        My.Forms.Bedrijven_Overall.Visible = True
    End Sub

End Class